import { createStore, combineReducers, applyMiddleware } from 'redux';

//applyMiddleware中间件拦截下来做异步的操作
//如果需要异步操作action就需要这个引入的包
import ReduxThunk from 'redux-thunk';

//2.导入所有reducer
import courseTabListReducer from './reducers/courseTabList';

//4.导入state
import courseTabListState from './states/courseTabList';

//3.汇总所有的reducer
const allReducers = combineReducers({
  courseTabList: courseTabListReducer,
  //其他的reducer ...
});

//1.创建仓库
//createStore(所有的reducer, 组合state, 中间件)
const store = createStore(
  allReducers,
  {
    courseTabList: courseTabListState,
    //其他的state...
  },
  applyMiddleware(ReduxThunk)
);

export default store;
